package com.example.broadcastbestpractice

import android.content.Intent
import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import android.widget.Toast

class LoginActivity : BaseActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_login)
        val login:Button = findViewById(R.id.login)
        login.setOnClickListener{
            val accountEdit:EditText = findViewById(R.id.accountEdit)
            val passwordEdit:EditText = findViewById(R.id.passwordEdit)
            val account = accountEdit.text.toString()
            val password = passwordEdit.text.toString()
            if (account=="admin"&&password=="123456"){
                val intent = Intent(this,MainActivity::class.java)
                startActivity(intent)
                finish()
            }else{
                Toast.makeText(this,"account or password is invalid",Toast.LENGTH_SHORT).show()
            }
        }
    }
}